#ifndef _CNF_SVR_DATABASE_HELPER_H_
#define _CNF_SVR_DATABASE_HELPER_H_

#include <string>
#include <list>

#include <mysql/mysql.h>

using std::string;
using std::list;

struct NS_CNF {
        string ip;
        unsigned short port;
        int status;
	int thread_num;
	int socket_conn_timeout;
	int socket_idle_timeout;
	int socket_send_timeout;
	int socket_recv_timeout;
	int socket_max_request_size;
	int socket_max_response_size;
	int client_conn_pool_size;
	string log_cnf_file;
	string root_data_path;
        time_t create_time;
};

struct MDS_CNF {
        string ip;
        unsigned short port;
        int id;
        int weight;
        int status;
	int thread_num;
	int socket_conn_timeout;
	int socket_idle_timeout;
	int socket_send_timeout;
	int socket_recv_timeout;
	int socket_max_request_size;
	int socket_max_response_size;
	int client_conn_pool_size;
	string log_cnf_file;
	string root_data_path;
        time_t create_time;
};

struct DS_CNF {
        string ip;
        unsigned short port;
        int id;
        int mds_id;
        int read_weight;
        int write_weight;
        int status;
	int thread_num;
	int socket_conn_timeout;
	int socket_idle_timeout;
	int socket_send_timeout;
	int socket_recv_timeout;
	int socket_max_request_size;
	int socket_max_response_size;
	int client_conn_pool_size;
	string log_cnf_file;
	string root_data_path;
        time_t create_time;
};

int db_get_all_cnf(MYSQL * mysql, NS_CNF & ns, list<MDS_CNF> & l_mds, list<DS_CNF> & l_ds);

#endif
